package cn.netjava.wk;


import java.io.File;

public class FileCount {
/*
 * @param filezSize @value String directory @return long
 */
	long size=0;
	public long fileSize(String dir){
		File file=new File(dir);
        if(file.isDirectory()){
		File[]ff=file.listFiles();
       if(ff!=null){
        for(int i=0;i<ff.length;i++){
        	if(ff[i].isFile()){
        		size+=ff[i].length();        		
        	}else if(ff[i].isDirectory()){
        		fileSize(ff[i].getAbsolutePath());
        	}
        }	
       }
        }else{
        	if(file.isFile()){
        		size=file.length();
        	}
        }
     return size;
	}

}